#include <iostream>
using namespace std;

class Creature {
public:
Creature();
float getHealth();
void reduceHealth(float health);
//定义private属性，那么他只能在本类中访问
private:
 string name;
 float health = 100;
 // 可以在派生类中访问
 protected:
    int limbs;
};

class Goblin : public Creature {
public :
    int getLimbs() {
        //我们可以在派生类访问父类的protected的属性
        return limbs;
    }
};

int main() {
    Creature igor;
    igor.reduceHealth(40.0f);
    cout << "health :" << igor.getHealth() << endl;
    return 0;
}

Creature::Creature() {
    cout << "Creature created...." << endl;
}

float Creature::getHealth() {
    return this->health;
}

void Creature::reduceHealth(float health) {
    this->health -= health;
} 
